package com.itkang.observer;

import java.util.Observable;
import java.util.Observer;

/**
 * <p>
 * 场景:
 * </p>
 *
 * @author york yuan
 * @version 1.0
 * @since 15/7/8下午2:53
 */
public class LucyObserver implements Observer {
    /**
     * This method is called whenever the observed object is changed. An
     * application calls an <tt>Observable</tt> object's
     * <code>notifyObservers</code> method to have all the object's
     * observers notified of the change.
     *
     * @param o   the observable object.
     * @param arg an argument passed to the <code>notifyObservers</code>
     */
    public void update(Observable o, Object arg) {
        //可以判断是哪个subject发出的通知
        if (o instanceof WeatherObserver){
            System.out.println("yes");
        }
        System.out.println("notice lucy : " + arg);
    }
}
